import request from '@/utils/request'
import requestfile from '@/utils/requestfile'

// 获得API 获得会话日志分页列表
export function getAccessTokenPage(query) {
  return request({
    url: '/system/session-log/page',
    method: 'get',
    params: query
  })
}

// 取消用户登陆
export function deleteAccessToken(id) {
  return request({
    url: '/system/oauth2-token/delete?accessToken=' + id,
    method: 'get'
  })
}

// 获得API 获得登录日志分页列表
export function getLoginLogPage(query) {
    return request({
      url: '/system/login-log/page',
      method: 'get',
      params: query
    })
  }

// 导出API 导出登录日志 Excel
export function exportLoginLog(query,cancelToken) {
    return requestfile({
      url: '/system/login-log/export',
      method: 'get',
      params: query,
      responseType: 'blob',
      cancelToken,
    })
  }

  // 获得API 获得导出登录日志分页历史列表
export function getLoginLogHistoryPage(query) {
  return request({
    url: '/system/login-log/export-history-page',
    method: 'get',
    //responseType: 'blob',
    params: query
  })
}
// 下载导出过的登录日志 Excel 
export function downloadExportLoginLogHistory(id) {
  return request({
    url: '/system/login-log/download-export-history/'+id,
    method: 'get',
    responseType: 'blob',
  })
}
// 获得API 查看操作日志分页列表
export function getOperatePage(query) {
  return request({
    url: '/system/operate-log/page',
    method: 'get',
    params: query
  })
}

// 导出API 导出操作日志 Excel
export function exportOperate(query,cancelToken) {
  return requestfile({
    url: '/system/operate-log/export',
    method: 'get',
    params: query,
    responseType: 'blob',
    cancelToken,
  })
}

// 获得API 获得导出操作日志分页历史列表
export function getOperateHistoryPage(query) {
return request({
  url: '/system/operate-log/export-history-page',
  method: 'get',
  params: query
})
}
// 下载导出过的操作日志 Excel 
export function downloadExportOperateHistory(id) {
return request({
  url: '/system/operate-log/download-export-history/'+id,
  method: 'get',
  responseType: 'blob',
})
}

// 登录日志查询导出结果
export function getExportResult_1(fileTag) {
  return request({
    url: '/system/login-log/export/result'+'?fileTag='+fileTag,
    method: 'get',
  })
}
// 操作日志查询导出结果
export function getExportResult_2(fileTag) {
  return request({
    url: '/system/operate-log/export/result'+'?fileTag='+fileTag,
    method: 'get',
  })
}